from pathlib import Path


def concat(path1, path2):
    if not Path(path1).exists() or not Path(path2).exists():
        print('文件不存在')
        return
    # file1 = open(path1, 'r')
    # file2 = open(path2, 'r')
    with open('concat.txt', 'w') as file3:
        file3.write(Path(path1).read_text() + Path(path2).read_text())


def test_concat():
    # todo: 测试代码
    concat('file1.txt', 'file2.txt')


if __name__ == '__main__':
    # file = open('file1.txt', 'r')

    concat('file1.txt', 'file2.txt')
